<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld"%>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- saved from url=(0033)http://beijing.haozu.com/listing/ -->
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

		<title>租房，买房</title>
		<link rel="stylesheet" rev="stylesheet" href="css/Listing_Index.css"
			type="text/css">
		<style>
			a.red{
				color:red;
			}
		</style>
	</head>
	<body id="haozu">
		<div class="top">
			<div class="logo_icon">
				租房网logo
			</div>
				<ul class="nav">
				<li class="select">
					<a href="<%=basePath%>index.do">租房</a>
				</li>
				<li>
					<a href="<%=basePath%>sell/list.do">买房</a>
				</li>
				</ul>
			<div class="clear"></div>
		</div>
		<div id="content">
			<div class="head_listing_nav">
				<div class="listing_area">
					<span>区域:</span>
					<a href="javascript:query('zone','')">不限</a>
					<c:forEach var="zone" items="${zoneList}">
						<a href="javascript:query('zone','${zone.code}')"<c:if test="${home.zone==zone.code}">class="red"</c:if>>${zone.name}</a>
					</c:forEach>
				</div>
				<div class="listing_area">
					<span>租金:</span>
					<a href="javascript:query('rent','')">不限</a>
					<c:forEach var="rent" items="${rentList}">
						<a href="javascript:query('rent','${rent.code}')"<c:if test="${home.rent==rent.code}">class="red"</c:if>>${rent.name}</a>
					</c:forEach>
				</div>
				<div class="listing_area">
					<span>房型:</span>
					<a href="javascript:query('houseType','')">不限</a>
					<c:forEach var="houseType" items='${houseTypeList}'>
						<a href="javascript:query('houseType','${houseType.code}')"<c:if test="${home.houseType==houseType.code}">class="red"</c:if>>${houseType.name}</a>
					</c:forEach>
				</div>
				<div class="listing_area">
					<span>装修:</span>
					<a href="javascript:query('fix','')">不限</a>
					<c:forEach var="fix" items="${fixList}">
						<a href="javascript:query('fix','${fix.code}')"<c:if test="${home.fix==fix.code}">class="red"</c:if>>${fix.name}</a>
					</c:forEach>
				</div>
				<div class="listing_area">
					<span>方式:</span>
					<a href="javascript:query('rentWay','')">不限</a>
					<a href="javascript:query('rentWay','all')" title="整租" <c:if test="${home.rentWay=='all'}">class="red"</c:if>>整租</a>
					<a href="javascript:query('rentWay','half')" title="合租" <c:if test="${home.rentWay=='half'}">class="red"</c:if>> 合租</a>
				</div>
			</div>
			<div class="main_content">
				<div class="content_l">
					<div class="search_bar">
						<label>地址搜索：</label>
						<input class="inputText_25_200" type="text" id="searchAddress" value="${home.address}"/>
						<input class="inputButton_27_80" type="button" value="搜索"  onclick="search('address');" />
						<div class="clear"></div>
					</div>
					<div class="search-result2">
						<div class="search_bottom">
							<div class="totalnum">
								共有
								<strong>${ page.totalCount }</strong> 套符合要求的房子
							</div>
						</div>
					</div>
					<div class="listing_prop_proplist" id="apf_id_13_list">
						<div class="clear"></div>
						<c:forEach var="h" items="${ page.result }">
							<li class="listprop prop_hover" id="">
								<div class="photo">
									<c:choose>
										<c:when test="${h.smallIcon eq null || h.smallIcon eq ''}">
											<img src="<%=basePath%>images/default_image.gif" />
										</c:when>
										<c:otherwise>
											<img width="100" height="100"
												src="<%=basePath%>img/${h.smallIcon}" />
										</c:otherwise>
									</c:choose>
								</div>
								<div class="details">
									<h4>
										<a href="<%=basePath%>/renthome/get.do?id=${h.id}">${ h.name }</a>
									</h4>
									<address>
										${h.address}
									</address>
									<div style="vertical-align: baseline;">
										<c:if test="${h.rentWay=='all'}">[整租]</c:if>
										<c:if test="${h.rentWay=='half'}">[合租]</c:if>
										面积：${h.area}平米，装修：
											<c:forEach var="fix" items="${fixList}">
											<c:if test="${fix.code==h.fix}">${fix.name}</c:if>	
											</c:forEach>
										
										，楼层：${h.floor}层
									</div>
									<div class="broker">
										<fmt:formatDate pattern="yyyy-MM-dd"
											value="${h.publishDate}" />
									</div>
								</div>
								<div class="price">
									<strong>${h.price}</strong> 元/月
								</div>
								<div class="area">
									<div>
										<span> <c:forEach var="type" items="${houseTypeList}">
												<c:if test="${h.houseType == type.code}">${type.name}</c:if>
											</c:forEach> </span>
									</div>
								</div>
								<div class="tags">
								</div>
							</li>
						</c:forEach>
					</div>
					<div class="multi">
						<form id="query" action="<%=basePath%>index.do"
							method="post">
							<input type="hidden" id="zone" name="zone" value="${home.zone}" />
							<input type="hidden" id="rent" name="rent" value="${home.rent}" />
							<input type="hidden" id="fix" name="fix" value="${home.fix}" />
							<input type="hidden" id="area" name="area" value="${home.area}" />
							<input type="hidden" id="houseType" name="houseType"
								value="${home.houseType}" />
							<input type="hidden" id="rentWay" name="rentWay" value="${home.rentWay}"/>
							<input type="hidden" id="address" name="address" value="${home.address}" />
							<c:if test="${page.totalPages>0}">
								<span>共${page.totalCount}条记录</span>
								<span>共${page.totalPages}页</span>
								<select name="currentPage" id="pageNo" onchange="query()">
									<c:forEach var="pageNo" begin="1" end="${page.totalPages}">
										<option value="${pageNo}"
											<c:if test="${pageNo==page.pageNo}">selected</c:if>>
											第${pageNo}页
										</option>
									</c:forEach>
								</select>
							</c:if>
						</form>
						<script>
				function query(type,value){
					var obj=document.getElementById(type);
					if(obj&&value!=''){
						obj.value=value;
					}
					document.getElementById("query").submit();				
				}	
				function search(){
					document.getElementById('address').value=document.getElementById("searchAddress").value;
					document.getElementById("query").submit();				
			
				}
						
			</script>

					</div>
				</div>
			</div>
		</div>
	</body>
</html>
